package com.xbongbong.workflow.pojo.nodes;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * @author chenpeng
 * @version 1.0
 * @date 2021-05-10 15:19
 * @description 条件节点
 */
@Getter
@Setter
@ToString
public class ConditionNode implements Serializable {

    private static final long serialVersionUID = -5750321180136291413L;

    /**
     * 流转条件类型,1使用自定义流转条件，2使用else条件；3：有结果；4：无结果，5:审批通过，6:审批拒绝
     * @see com.xbongbong.workflow.enums.WorkflowNodeConditionTypeEnum
     */
    private Integer conditionType;
    /**
     * 流转条件
     */
    @Valid
    @NotNull
    private WorkflowJointConditionPojo conditions;
    /**
     * 分支类型，1: 普通分支/ 2:查找结果分支
     * @see com.xbongbong.workflow.enums.ConditionTypeEnum
     *
     */
    private Integer type;

    /**
     * 触发表单的数据来源是编辑前还是编辑后；编辑前：0；编辑后：1
     */
    private Integer editedData;

    public ConditionNode() {
    }

    public ConditionNode(Integer conditionType, WorkflowJointConditionPojo conditions, Integer type, Integer editedData) {
        this.conditionType = conditionType;
        this.conditions = conditions;
        this.type = type;
        this.editedData = editedData;
    }
}
